class Task20:
    def run(self, string):
        state = 0

        for char in string:
            if state == 0:
                if char == '+' or char == '-':
                    state = 1
                elif self.is_digit(char):
                    state = 2
                else:
                    return False

            elif state == 1:
                if self.is_digit(char):
                    state = 2
                else:
                    return False

            elif state == 2:
                if self.is_digit(char):
                    state = 2
                elif char == '.':
                    state = 3
                elif char == 'E' or char == 'e':
                    state = 5
                else:
                    return False

            elif state == 3:
                if self.is_digit(char):
                    state = 4
                else:
                    return False

            elif state == 4:
                if self.is_digit(char):
                    state = 4
                elif char == 'E' or char == 'e':
                    state = 5
                else:
                    return False

            elif state == 5:
                if char == '+' or char == '-':
                    state = 6
                elif self.is_digit(char):
                    state = 7
                else:
                    return False

            elif state == 6:
                if self.is_digit(char):
                    state = 7
                else:
                    return False

            elif state == 7:
                if self.is_digit(char):
                    state = 7
                else:
                    return False

        return state == 2 or state == 4 or state == 7

    def is_digit(self, char):
        return char == '0' or char == '1' or char == '2' \
            or char == '3' or char == '4' or char == '5' \
            or char == '6' or char == '7' or char == '8' \
            or char == '9'
